#!/bin/bash

IP=`env | grep 'IP_ADDRESS' | cut -d= -f2`
NAME=$1

# 修改窗口名称
export PS1=$(echo $PS1 | sed "s/\\\u@\\\h/$IP@$NAME/g")

function terminalTitle(){
    echo $*
    if [ -z "$ORIG" ]; then
        ORIG=$PS1
    fi
    TITLE="\[\e]2;$*\a\]"
    PS1=${ORIG}${TITLE}
}
terminalTitle $NAME
